package cn.iocoder.yudao.module.crm.controller.admin.clue.vo;

import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.module.crm.enums.customField.FieldEnum;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author zhangzhiwei
 * crm的新增，保存需要查询的字段对象
 */
@Data
@ToString
@Accessors(chain = true)
public class CrmModelFiledVO implements Serializable {

    public CrmModelFiledVO() {

    }

    public CrmModelFiledVO(String fieldName, String name) {
        this.fieldName = fieldName;
        this.name = name;
    }

    public CrmModelFiledVO(String fieldName, FieldEnum fieldEnum) {
        this.fieldName = StrUtil.toCamelCase(fieldName);
        this.type = fieldEnum.getType();
        this.formType = fieldEnum.getFormType();
    }

    public CrmModelFiledVO(String fieldName, FieldEnum fieldEnum, Integer fieldType) {
        this.fieldName = StrUtil.toCamelCase(fieldName);
        this.type = fieldEnum.getType();
        this.formType = fieldEnum.getFormType();
        this.fieldType = fieldType;
    }

    public CrmModelFiledVO(String fieldName, FieldEnum fieldEnum, String name, Integer fieldType) {
        this.fieldName = StrUtil.toCamelCase(fieldName);
        this.type = fieldEnum.getType();
        this.formType = fieldEnum.getFormType();
        this.name = name;
        this.fieldType = fieldType;
    }
    public CrmModelFiledVO(String fieldName, FieldEnum fieldEnum, String name, Integer fieldType,List<String>setting) {
        this.fieldName = StrUtil.toCamelCase(fieldName);
        this.type = fieldEnum.getType();
        this.formType = fieldEnum.getFormType();
        this.name = name;
        this.fieldType = fieldType;
        this.setting = setting;
    }
    public CrmModelFiledVO(String fieldName, FieldEnum fieldEnum, String name, Integer fieldType,Long fieldHeadId) {
        this.fieldName = StrUtil.toCamelCase(fieldName);
        this.type = fieldEnum.getType();
        this.formType = fieldEnum.getFormType();
        this.name = name;
        this.fieldType = fieldType;
        this.fieldHeadId = fieldHeadId;
    }
    public CrmModelFiledVO(String fieldName, FieldEnum fieldEnum, String name, Integer fieldType, Integer isImmobilization) {
        this.fieldName = StrUtil.toCamelCase(fieldName);
        this.type = fieldEnum.getType();
        this.formType = fieldEnum.getFormType();
        this.name = name;
        this.fieldType = fieldType;
        this.isImmobilization = isImmobilization;
    }

    private Long fieldId;

    private String fieldName;

    private String formType;

    private String name;

    private Integer type;

    private String inputTips;

    private Integer maxLength;

    private Object defaultValue;

    private Integer isUnique;

    private Integer isNull;

    private String options;

    private Integer fieldType;
    private Long fieldHeadId;

    private Integer operating;

    private List<String> setting = new ArrayList<>();

    private Integer authLevel;

    private Object value;

    private Integer sysInformation;

    private Integer isOut;

    private Integer isHidden;

    private Integer autoGeneNumber;

    public CrmModelFiledVO setFieldName(String fieldName) {
        this.fieldName = StrUtil.toCamelCase(fieldName);
        return this;
    }

    private Integer sorting;

    private Integer stylePercent;

    private String maxNumRestrict;

    private String minNumRestrict;

    private Integer precisions;

    private String formPosition;

    private Long formAssistId;

    /**
     * 坐标
     * */
    private Integer xAxis;

    private Integer yAxis;
    /**
     * 是否固定
     */
    private Integer isImmobilization;

    private Map<String, Object> optionsData;


    private String remark;



}
